package com.xingxing.Activity;

import android.graphics.Color;
import android.view.View;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import com.xingxing.Util.CommonUtils;
import com.xuexiang.xui.utils.StatusBarUtils;
import com.xuexiang.xui.utils.XToastUtils;
import com.xuexiang.xui.widget.imageview.RadiusImageView;
import com.xuexiang.xui.widget.popupwindow.ViewTooltip;

public class MyCardActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //设置沉浸式状态栏
        StatusBarUtils.translucent(this);
        //设置黑色字体状态栏
        StatusBarUtils.setStatusBarLightMode(this);
        setContentView(R.layout.activity_my_card);

        RadiusImageView cardFont = findViewById(R.id.radius_image_view_card_front);
        RadiusImageView cardBack = findViewById(R.id.radius_image_view_card_back);
        TextView lostCard = findViewById(R.id.lost_card);
        TextView cardId = findViewById(R.id.card_id);
        TextView userName = findViewById(R.id.user_name_value);
        cardId.setText(CommonUtils.GetUserInfo().getUserCardId());
        userName.setText(CommonUtils.GetUserInfo().getUserName());

        ViewTooltip
                .on(cardFont)
                .position(ViewTooltip.Position.TOP)
                .text("卡的正面")
                .show()
                .setListenerHide(new ViewTooltip.ListenerHide() {
                    @Override
                    public void onHide(View view) {
                        ViewTooltip
                                .on(cardBack)
                                .position(ViewTooltip.Position.TOP)
                                .text("卡的背面")
                                .show();
                    }
                });

        cardFont.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ViewTooltip
                        .on(cardFont)
                        .position(ViewTooltip.Position.TOP)
                        .text("卡的正面")
                        .show();
            }
        });

        cardBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ViewTooltip
                        .on(cardBack)
                        .position(ViewTooltip.Position.TOP)
                        .text("卡的背面")
                        .show();
            }
        });

        lostCard.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ViewTooltip
                        .on(lostCard)
                        .animation(new ViewTooltip.FadeTooltipAnimation())
                        .position(ViewTooltip.Position.BOTTOM)
                        .text("该功能还在开发中!来块🍕赞助一下？")
                        .show();
            }
        });


    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }
}